﻿using System;
using System.Drawing;
using System.Windows.Forms;
using GameLibrary.Model;
using WeifenLuo.WinFormsUI.Docking;

namespace GameDesigner2
{
    public partial class Main : Form
    {
        private DockContent propertyForm = new PropertyForm();
        private DockContent consoleForm = new ConsoleForm();
        private DockContent treeForm = new TreeForm();
//        private DockContent scriptForm = new ScriptForm();

        public Main()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.dockPanel1.SuspendLayout(true);
//            scriptForm.Show(this.dockPanel1, DockState.DockBottom);
//            this.dockPanel1.DockBottomPortion = 0.5;
            propertyForm.Show(this.dockPanel1, DockState.DockRight);
            treeForm.Show(this.dockPanel1, DockState.DockLeft);
            this.dockPanel1.ResumeLayout(true, true);

            this.dockPanel1.SuspendLayout(true);
            DockPane left = this.dockPanel1.DockWindows[1].NestedPanes[0];
            consoleForm.Show(left, DockAlignment.Bottom, .5);
            this.dockPanel1.ResumeLayout(true, true);
        }

        void NewToolStripMenuItemClick(object sender, EventArgs e)
        {
            CreateNewGame();
        }
        
        private void CreateNewGame()
        {
            DockContent tree = new GameForm();
            this.dockPanel1.SuspendLayout(true);
            tree.Show(this.dockPanel1, DockState.Document);
            this.dockPanel1.ResumeLayout(true, true);
        }
        
//        void ToolStripButton3Click(object sender, EventArgs e)
//        {
//            CreateNewGame();
//        }

//        void ButtonPlayClick(object sender, EventArgs e)
//        {
//            if (this.ActiveMdiChild != null &&
//                this.ActiveMdiChild.GetType() == typeof(GameForm))
//            {
//                GameForm gameForm = (GameForm)this.ActiveMdiChild;
//                PlayForm frm = new PlayForm(gameForm.GameDef);
//                frm.Size = new Size(850, 550);
//                frm.Show(this);
//            }
//        }
//
//        void ToolStripButton1Click(object sender, EventArgs e)
//        {
//            GameDef game = CreateNewGame();
//            TestBuilder.BuildCoinFight(game);
//        }
//        
//        void ToolStripMenuItem1Click(object sender, EventArgs e)
//        {
//            GameDef game = CreateNewGame();
//            TestBuilder.BuildCoinFight(game);
//        }
//        
//        void ToolStripMenuItem2Click(object sender, EventArgs e)
//        {
//            GameDef game = CreateNewGame();
//            TestBuilder.BuildConqureFight(game);
//        }
//        
//        void DualToolStripMenuItemClick(object sender, EventArgs e)
//        {
//            GameDef game = CreateNewGame();
//            TestBuilder.BuildDual(game);
//        }
//        
//        void MineSweeperToolStripMenuItemClick(object sender, EventArgs e)
//        {
//            GameDef game = CreateNewGame();
//            MineSweeper.Build(game);
//        }
        
    }
    
}
